<template>
  <el-dialog title="新增" :visible.sync="dialogVisible" width="30%" class="popup" :before-close="handleClose">
    <el-form ref="ruleForm" :model="ruleForm" status-icon :rules="rules" label-width="110px" class="demo-ruleForm">
      <el-form-item label="公告标题" prop="pass">
        <el-input v-model="ruleForm.age" />
      </el-form-item>
      <el-form-item label="公告类型" prop="pass">
        <el-select v-model="ruleForm.region" placeholder="请选择审批级别">
          <el-option label="通知" value="shanghai" />
          <el-option label="公告" value="beijing" />
        </el-select>
      </el-form-item>
      <el-form-item label="发布时间" prop="value1">
        <el-date-picker v-model="ruleForm.value1" type="date" placeholder="选择日期" />
      </el-form-item>
      <el-form-item label="发布状态">
        <el-select v-model="ruleForm.region" placeholder="请选择审批级别">
          <el-option label="正常" value="shanghai" />
          <el-option label="关闭" value="shanghai" />
        </el-select>
      </el-form-item>
      <el-form-item label="公告内容">
        <el-input v-model="ruleForm.desc" type="textarea" />
      </el-form-item>
    </el-form>
    <span slot="footer" class="dialog-footer">
      <el-button size="small" @click="dialogVisible = false">取 消</el-button>
      <el-button type="primary" size="small" @click="dialogVisible = false">确 定</el-button>
    </span>
  </el-dialog>
</template>

<script>
export default {
  data () {
    return {
      dialogVisible: false,
      ruleForm: {
        pass: '',
        checkPass: '',
        age: '',
        value1: ''
      }
    }
  },
  computed: {
    rules () {
      return {
        pass: [
          { required: true, message: '请输入活动名称', trigger: 'blur' }
        ],
        checkPass: [
          { required: true, message: '请输入活动名称', trigger: 'blur' }
        ],
        age: [
          { required: true, message: '请输入活动名称', trigger: 'blur' }
        ]
      }
    }

  },
  methods: {
    toggleAdd (flag) {
      this.dialogVisible = flag
    },
    handleClose (done) {
      this.$confirm('确认关闭？')
        .then(_ => {
          done()
        })
        .catch(_ => { })
    }
  }
}
</script>

<style lang="scss" scoped>
.popup {
  ::v-deep .el-dialog {
    border-radius: 4px;
  }
  ::v-deep .el-dialog__header {
    border-bottom: 1px solid #cdd0db;
  }
  ::v-deep .el-dialog__body {
    padding: 30px;
  }
}
</style>
